package com.fuchen.academic.convertor;

import org.springframework.core.convert.converter.Converter;

import com.fuchen.academic.util.StringUtil;

public class BooleanConvertor implements Converter<String, Boolean> {

	@Override
	public Boolean convert(String arg0) {
		if(StringUtil.isNotEmpty(arg0)){
			if("0".equals(arg0) || "false".equals(arg0)){
				return false;
			}else if("1".equals(arg0) || "true".equals(arg0)){
				return true;
			}
		}
		return null;
	}

}
